/*
* Copyright(C) 2010,Hikvision Digital Technology Co., Ltd 
* 
* File   name��consoleMain.cpp
* Discription��
* Version    ��1.0
* Author     ��panyadong
* Create Date��2010_3_25
* Modification History��
*/

#ifndef __APPLE__

#include <stdio.h>
#include <iostream>
//#include "GetStream.h"
#include "public.h"
#include <string.h>
#include "HiK_opencv.h"
using namespace std;



int main(int argc, char **argv)
{

  ros::init(argc, argv, "hk_opencv_example");
  ros::NodeHandle nh;
  image_transport::ImageTransport it(nh);
  image_transport::Publisher image_pub = it.advertise("hk_opencv_example/image_raw", 1);

  

  HK_camera camera(&image_pub);
  if (camera.Init())
  {
    cout << "init success" << endl;
    if (camera.Login("192.168.2.30", "admin", "nuaanrc505", 8000))
    {
      cout << "login success" << endl;
      camera.show();
    }
    else
    {
      cout << "login fail" << endl;
    }
  }
  else
  {
    cout << "init fail" << endl;
  }

  while (ros::ok())
  {
    camera.publish();
    usleep(4000);
  }
  return 0;
}

#endif
